package com.ncu.controller.client;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ncu.domain.Active;
import com.ncu.domain.Ads;
import com.ncu.service.ActiveService;
import com.ncu.service.AdsService;
import com.ncu.service.TypeService;
import com.ncu.utils.ResponseResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/client/menu")
public class ClientMenuController {


    @Resource
    TypeService typeService;

    @Resource
    ActiveService activeService;

    @Resource
    AdsService adsService;

    /**
     * 获取前台分类列表
     * @return
     */
    @GetMapping("/getFoodsList")
    public ResponseResult getBooksList(){

        return ResponseResult.success("获取menu成功", typeService.getFoodsList());
    }
    /**
     * 获取轮播图
     * @return
     */
    @GetMapping("/getAdsList")
    public ResponseResult getAdsList(){

        List<Ads> list = adsService.list(new LambdaQueryWrapper<Ads>().eq(Ads::getStatus, false));

        return ResponseResult.success("获取轮播图成功", list);
    }

    /**
     * 获取横幅
     * @return
     */
    @GetMapping("/getActiveList")
    public ResponseResult getActiveList(){

        List<Active> list = activeService.list(new LambdaQueryWrapper<Active>().eq(Active::getStatus, false));

        return ResponseResult.success("获取横幅成功", list);
    }

}
